home *** CD-ROM | disk | FTP | other *** search
- FLOOR(3M) Last changed: 1-8-99
-
-
- NNAAMMEE
- fflloooorr, fflloooorrll, fffflloooorr, fflloooorrff, cceeiill, cceeiillll, ffcceeiill, cceeiillff, ccooppyyssiiggnn,
- ccooppyyssiiggnnll, ddrreemm, ddrreemmll, ffmmoodd, ffmmooddll, ffmmooddff, ffaabbssll, ffaabbss, ffaabbssff,
- rreemmaaiinnddeerr, rriinntt, rriinnttll, ttrruunncc, ttrruunnccll, ffttrruunncc, ttrruunnccff - Floor,
- ceiling, remainder, absolute value, nearest integer, and truncation
- functions
-
- SSYYNNOOPPSSIISS
- ##iinncclluuddee <<mmaatthh..hh>>
-
- ddoouubbllee fflloooorr ((ddoouubbllee xx));;
- lloonngg ddoouubbllee fflloooorrll ((lloonngg ddoouubbllee xx));;
- ffllooaatt fffflloooorr ((ffllooaatt xx));;
- ffllooaatt fflloooorrff ((ffllooaatt xx));;
-
- ddoouubbllee cceeiill ((ddoouubbllee xx));;
- lloonngg ddoouubbllee cceeiillll ((lloonngg ddoouubbllee xx));;
- ffllooaatt ffcceeiill ((ffllooaatt xx));;
- ffllooaatt cceeiillff ((ffllooaatt xx));;
-
- ddoouubbllee ccooppyyssiiggnn ((ddoouubbllee xx,, ddoouubbllee yy));;
- lloonngg ddoouubbllee ccooppyyssiiggnnll \\
- ((lloonngg ddoouubbllee xx,, lloonngg ddoouubbllee yy));;
-
- ""ddoouubbllee ddrreemm ((ddoouubbllee xx,, ddoouubbllee yy));;""
- lloonngg ddoouubbllee ddrreemmll \\
- ((lloonngg ddoouubbllee xx,, lloonngg ddoouubbllee yy));;
-
- ""ddoouubbllee rreemmaaiinnddeerr ((ddoouubbllee xx,, ddoouubbllee yy));;""
-
- ddoouubbllee ttrruunncc ((ddoouubbllee xx));;
- lloonngg ddoouubbllee ttrruunnccll ((lloonngg ddoouubbllee xx));;
- ffllooaatt ffttrruunncc ((ffllooaatt xx));;
- ffllooaatt ttrruunnccff ((ffllooaatt xx));;
-
- ddoouubbllee ffmmoodd ((ddoouubbllee xx,, ddoouubbllee yy));;
- lloonngg ddoouubbllee ffmmooddll \\
- ((lloonngg ddoouubbllee xx,, lloonngg ddoouubbllee yy));;
- ffllooaatt ffmmooddff ((ffllooaatt xx,, ffllooaatt yy));;
-
- ddoouubbllee ffaabbss ((ddoouubbllee xx));;
- lloonngg ddoouubbllee ffaabbssll ((lloonngg ddoouubbllee xx));;
- ffllooaatt ffaabbssff ((ffllooaatt xx));;
-
- ddoouubbllee rriinntt ((ddoouubbllee xx));;
- lloonngg ddoouubbllee rriinnttll ((lloonngg ddoouubbllee xx));;
-
- IIMMPPLLEEMMEENNTTAATTIIOONN
- IRIX systems
-
- DDEESSCCRRIIPPTTIIOONN
- The ffmmoodd, ffaabbss, and ttrruunncc functions listed in the SYNOPSIS as well as
- the long double and single-precision versions of the remaining
- functions, are only available in the standard math library, --llmm,, and
- in --llmmxx.
-
- The fflloooorr functions return the largest integer not greater than _x.
- The argument _x is ddoouubbllee for fflloooorr, lloonngg ddoouubbllee for fflloooorrll, and ffllooaatt
- for fffflloooorr and its ANSI-named equivalent fflloooorrff.
-
- ccooppyyssiiggnn((xx,,yy)) returns the number with the magnitude of _x and the sign
- of _y. ccooppyyssiiggnnll is the lloonngg ddoouubbllee counterpart of ccooppyyssiiggnn.
-
- ddrreemm((xx,,yy)) returns the remainder rr ::== xx -- _n**yy where _n is the integer
- nearest the exact value of xx//yy; moreover, if ||nn--xx//yy||==11//22 then _n is
- even. Consequently, the remainder is computed exactly and ||rr|| <<
- ||yy||//22. But ddrreemm((xx,,00)) is exceptional; see the DIAGNOSTICS section on
- this man page. rreemmaaiinnddeerr is an alternate entry point for ddrreemm. ddrreemmll
- is the lloonngg ddoouubbllee counterpart of ddrreemm.
-
- The cceeiill functions return the smallest integer not less than _x. The
- argument _x is ddoouubbllee for cceeiill, lloonngg ddoouubbllee for cceeiillll, and ffllooaatt for
- ffcceeiill and its ANSI-named equivalent cceeiillff.
-
- The ttrruunncc functions return the integer (represented as a floating-
- point number) of _x with the fractional bits truncated. The argument _x
- is ddoouubbllee for ttrruunncc, lloonngg ddoouubbllee for ttrruunnccll, and ffllooaatt for ffttrruunncc.
-
- ffaabbss returns the absolute value of the ddoouubbllee _x, |_x|. It also has
- counterparts of type lloonngg ddoouubbllee and ffllooaatt,, namely ffaabbssll, and ffaabbssff,
- respectively.
-
- rriinntt returns the integer (represented as a double precision number)
- nearest its ddoouubbllee argument _x in the direction of the prevailing
- rounding mode. rriinnttll is the lloonngg ddoouubbllee counterpart of rriinntt. rriinntt
- has no counterpart that accepts an argument of type ffllooaatt.
-
- ffmmoodd returns the floating-point remainder of the division of its
- ddoouubbllee arguments _x by _y. It returns a number _f with the same sign as
- _x, such that "_x = _i_y + _f" for some integer _i, and |_f| < |_y|. Hence,
- the following two invocations yield 00..55:
-
- fmod(2.5,1.0)
- fmod(2.5,-1.0)
-
- while the following two invocations yield --00..55:
-
- fmod(-2.5,1.0)
- fmod(-2.5,-1.0)
-
- ffmmooddll is the counterpart of ffmmoodd which accepts and returns values of
- type lloonngg ddoouubbllee, and ffmmooddff is the counterpart of ffmmoodd which accepts
- and returns values of type ffllooaatt.
-
- DDIIAAGGNNOOSSTTIICCSS
- In the following diagnostics, functions in the standard math library
- lliibbmm..aa, are referred to as --llmm versions, those in math library lliibbmmxx..aa
- are referred to as --llmmxx versions, and those in the the BSD math
- library lliibbmm4433..aa are referred to as --llmm4433 versions. The --llmm and --llmmxx
- versions always return the default Quiet NaN and set eerrrrnnoo to EDOM
- when a NaN is used as an argument. A NaN argument usually causes the
- --llmm4433 versions to return the same argument. The --llmm4433 versions never
- set eerrrrnnoo. The value of HUGE_VAL is IEEE Infinity.
-
- If _y (and, possibly, _x) are zero, or if _x is +/-HUGE_VAL, the ffmmoodd
- functions return a quiet NaN, and set eerrrrnnoo to EDOM.
-
- IEEE 754 defines ddrreemm((xx,,00)) and ddrreemm((iinnffiinniittyy,,yy)) to be invalid
- operations that produce a .
-
- A version of the double-precision ffaabbss function exists in the C
- library as well. The C library version may not behave correctly when
- the input is NaN.
-
- NNOOTTEESS
- Long double operations on this system are only supported in round to
- nearest rounding mode (the default). The system must be in round to
- nearest rounding mode when calling any of the long double functions,
- or incorrect answers will result.
-
- Users concerned with portability to other computer systems should note
- that the long double and float versions of these functions are
- optional according to the ANSI C Programming Language Specification
- ISO/IEC 9899 : 1990 (E).
-
- Long double functions have been renamed to be compliant with the
- ANSI-C standard, however to be backward compatible, they may still be
- called with the double precision function name prefixed with a qq.
- (Exceptions: functions ffaabbssll and ffmmooddll may be called with names qqaabbss
- and qqmmoodd, respectively.)
-
- In the default rounding mode, round to nearest, rriinntt((xx)) is the integer
- nearest _x with the additional stipulation that if ||rriinntt((xx))--xx||==11//22 then
- rriinntt((xx)) is even. Other rounding modes can make rriinntt act like fflloooorr,
- or like cceeiill, or round towards zero.
-
- Another way to obtain an integer near x is to declare the following
- (in C):
-
- double x; int k; k=x;
-
- The C compilers round _x towards zero to get the integer _k. Also note
- that, if _x is larger than _k can accommodate, the value of _k and the
- presence or absence of an integer overflow are hard to detect.
-
- IEEE 754 requires ccooppyyssiiggnn((xx,,NNaann)) == +__+xx. In this implementation of
- ccooppyyssiiggnn, the sign of NaN is ignored. Thus, ccooppyyssiiggnn((xx,,+__+NNaaNN)) = +_x,
- and ccooppyyssiiggnn((+__+NNaaNN,,xx)) == ++NNaaNN.
-
- SSEEEE AALLSSOO
- aabbss(3C), mmaatthh(3M), mmaatthheerrrr(3M)
-
- This man page is available only online.
-